/*
 * 五子棋游戏样式 - 坚果派
 * Gomoku Game Styles by NutPi
 */

/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 
                 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 
                 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ========== 应用容器 ========== */
.app {
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 游戏头部 ========== */
.game-header {
    text-align: center;
    padding: 15px 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 5px;
    font-weight: 700;
}

.game-header .author {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* ========== 游戏信息栏 ========== */
.game-info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.current-player {
    font-size: 16px;
    font-weight: 600;
}

.current-player .label {
    color: #666;
}

.current-player .player {
    font-size: 18px;
    font-weight: 700;
    margin-left: 5px;
}

.current-player .player.black {
    color: #000;
}

.current-player .player.white {
    color: #666;
}

.game-status {
    font-size: 16px;
    font-weight: 600;
    color: #666;
}

/* ========== 分数面板 ========== */
.score-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.player-icon {
    font-size: 24px;
}

.score-label {
    font-size: 14px;
    color: #666;
}

.score {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    min-width: 30px;
    text-align: center;
}

.score-divider {
    font-size: 14px;
    color: #999;
    font-weight: 600;
}

/* ========== 棋盘容器 ========== */
.board-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameBoard {
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ========== 控制按钮 ========== */
.game-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.btn:active {
    transform: scale(0.95);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 20px;
}

.btn-text {
    font-size: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-secondary:hover {
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-info:hover {
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

/* ========== 弹窗样式 ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: 20px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 22px;
    color: #333;
    margin: 0;
}

.close {
    font-size: 32px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    color: #333;
    line-height: 1.6;
}

.modal-body h3 {
    font-size: 18px;
    margin-top: 15px;
    margin-bottom: 10px;
    color: #667eea;
}

.modal-body ul {
    list-style: none;
    padding-left: 0;
}

.modal-body li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.modal-body li:last-child {
    border-bottom: none;
}

.modal-body p {
    margin: 10px 0;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
}

/* ========== 获胜弹窗特殊样式 ========== */
.win-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.win-modal .modal-header h2 {
    color: white;
}

.win-animation {
    text-align: center;
    margin: 20px 0;
}

.trophy {
    font-size: 80px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.win-message {
    font-size: 18px;
    text-align: center;
    color: #333;
    line-height: 1.8;
    white-space: pre-line;
}

/* ========== Cordova 就绪指示器 ========== */
.device-ready-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========== 响应式设计 ========== */
@media screen and (max-width: 480px) {
    .app {
        padding: 5px;
    }
    
    .game-header h1 {
        font-size: 24px;
    }
    
    .game-header .author {
        font-size: 12px;
    }
    
    .game-info {
        padding: 10px;
    }
    
    .status-panel {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .score-panel {
        width: 100%;
    }
    
    .btn {
        padding: 10px 15px;
    }
    
    .btn-icon {
        font-size: 18px;
    }
    
    .btn-text {
        font-size: 11px;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px;
        font-size: 14px;
    }
}

/* ========== 横屏适配 ========== */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .app {
        padding: 5px;
    }
    
    .game-header {
        padding: 10px 0;
        margin-bottom: 10px;
    }
    
    .game-header h1 {
        font-size: 20px;
        margin-bottom: 2px;
    }
    
    .game-info {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .status-panel {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }
    
    .board-container {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .game-controls {
        margin-bottom: 10px;
    }
    
    .btn {
        padding: 8px 15px;
    }
}

/* ========== 深色模式支持 ========== */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .game-header,
    .game-info,
    .board-container {
        background: rgba(44, 62, 80, 0.95);
    }
    
    .game-header h1,
    .current-player .label,
    .game-status,
    .score-label,
    .modal-body {
        color: #ecf0f1;
    }
    
    .game-header .author {
        color: #95a5a6;
    }
    
    .current-player .player.black {
        color: #ecf0f1;
    }
    
    .status-panel {
        border-bottom-color: rgba(236, 240, 241, 0.1);
    }
    
    .modal-content {
        background-color: #2c3e50;
        color: #ecf0f1;
    }
    
    .modal-header {
        border-bottom-color: rgba(236, 240, 241, 0.1);
    }
    
    .modal-body h3 {
        color: #667eea;
    }
    
    .modal-body li {
        border-bottom-color: rgba(236, 240, 241, 0.1);
    }
    
    .modal-footer {
        border-top-color: rgba(236, 240, 241, 0.1);
    }
}

/* ========== 打印样式 ========== */
@media print {
    body {
        background: white;
    }
    
    .game-controls,
    .device-ready-indicator {
        display: none;
    }
}

/* ========== 动画效果 ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app > * {
    animation: fadeInUp 0.5s ease backwards;
}

.app > *:nth-child(1) { animation-delay: 0.1s; }
.app > *:nth-child(2) { animation-delay: 0.2s; }
.app > *:nth-child(3) { animation-delay: 0.3s; }
.app > *:nth-child(4) { animation-delay: 0.4s; }

/* ========== 无障碍支持 ========== */
.btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.close:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ========== 加载动画 ========== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== 触摸反馈 ========== */
.btn:active,
#gameBoard:active {
    transform: scale(0.98);
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
